<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>JCSDK Objective-C API Reference for iOS/macOS: JCStorage类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">JCSDK Objective-C API Reference for iOS/macOS
   &#160;<span id="projectnumber">2.3.3</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">构造函数</a> &#124;
<a href="#pub-static-methods">类方法</a> &#124;
<a href="interface_j_c_storage-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">JCStorage类 参考<div class="ingroups"><a class="el" href="group___xE6_x96_x87_xE4_xBB_xB6_xE5_xAD_x98_xE5_x82_xA8_xE6_xA8_xA1_xE5_x9D_x97.html">文件存储模块</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#import &lt;<a class="el" href="_j_c_storage_8h_source.html">JCStorage.h</a>&gt;</code></p>
<div class="dynheader">
类 JCStorage 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="interface_j_c_storage.png" alt=""/>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
构造函数</h2></td></tr>
<tr class="memitem:a179729e095c867fa7624fd1eb3e44a79"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_j_c_storage.html#a179729e095c867fa7624fd1eb3e44a79">uploadFileByExpireTime:expiredSeconds:cookie:</a></td></tr>
<tr class="separator:a179729e095c867fa7624fd1eb3e44a79"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4edb9dbd883adbb92c151bc0ef5f5e15"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_j_c_storage.html#a4edb9dbd883adbb92c151bc0ef5f5e15">downloadFile:savePath:cookie:</a></td></tr>
<tr class="separator:a4edb9dbd883adbb92c151bc0ef5f5e15"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2bf695039cbaaf8e57f4ab5515af2de6"><td class="memItemLeft" align="right" valign="top">(bool)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_j_c_storage.html#a2bf695039cbaaf8e57f4ab5515af2de6">cancelFile:</a></td></tr>
<tr class="separator:a2bf695039cbaaf8e57f4ab5515af2de6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa50915f7b3606dd3146c9074ad8cecb4"><td class="memItemLeft" align="right" valign="top">(bool)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_j_c_storage.html#aa50915f7b3606dd3146c9074ad8cecb4">cancelFileByCookie:</a></td></tr>
<tr class="separator:aa50915f7b3606dd3146c9074ad8cecb4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
类方法</h2></td></tr>
<tr class="memitem:ae49efaa195466115f07b20ae07bee4a8"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interface_j_c_storage.html">JCStorage</a> *)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interface_j_c_storage.html#ae49efaa195466115f07b20ae07bee4a8">create:callback:</a></td></tr>
<tr class="separator:ae49efaa195466115f07b20ae07bee4a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a845f5e55177573aad2972ab1edf32002"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interface_j_c_storage.html#a845f5e55177573aad2972ab1edf32002">destroy</a></td></tr>
<tr class="separator:a845f5e55177573aad2972ab1edf32002"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>文件存储类</p>
<p>上传文件：将文件上传至服务器，上传成功后服务器会返回文件地址，地址一般会有一定的有效期</p>
<p>下载文件：通过上传文件服务器返回的地址来下载该文件 </p>
</div><h2 class="groupheader">函数文档</h2>
<a id="a2bf695039cbaaf8e57f4ab5515af2de6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2bf695039cbaaf8e57f4ab5515af2de6">&#9670;&nbsp;</a></span>cancelFile:</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (bool) cancelFile: </td>
          <td></td>
          <td class="paramtype">(<a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> *)&#160;</td>
          <td class="paramname"><em>item</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>取消正在进行的文件上传下载</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">item</td><td><a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> 对象，由 <a class="el" href="interface_j_c_storage.html#a179729e095c867fa7624fd1eb3e44a79">uploadFileByExpireTime</a> ，<a class="el" href="interface_j_c_storage.html#a4edb9dbd883adbb92c151bc0ef5f5e15">downloadFile</a> 返回 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd><ul>
<li>true: 成功，会收到 <a class="el" href="protocol_j_c_storage_callback-p.html#a086c6c8b7e0e0188d8e8954b0288fd54">onFileResult</a> 回调</li>
<li>false: 失败，不会收到回调 </li>
</ul>
</dd></dl>

</div>
</div>
<a id="aa50915f7b3606dd3146c9074ad8cecb4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa50915f7b3606dd3146c9074ad8cecb4">&#9670;&nbsp;</a></span>cancelFileByCookie:</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (bool) cancelFileByCookie: </td>
          <td></td>
          <td class="paramtype">(id)&#160;</td>
          <td class="paramname"><em>cookie</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>通过cookie取消正在进行的文件上传下载</p>
<p>通过 cookie 来匹配缓存中的 <a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> 对象</p><ul>
<li>若能匹配上，则会调用 <a class="el" href="interface_j_c_storage.html#a2bf695039cbaaf8e57f4ab5515af2de6">cancelFile</a> 方法并它提供返回值</li>
<li>若匹配不上，则会直接返回 false</li>
</ul>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">cookie</td><td>上传下载传入的 cookie </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd><ul>
<li>true: 成功</li>
<li>false: 失败 </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ae49efaa195466115f07b20ae07bee4a8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae49efaa195466115f07b20ae07bee4a8">&#9670;&nbsp;</a></span>create:callback:</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">+ (<a class="el" href="interface_j_c_storage.html">JCStorage</a>*) create: </td>
          <td></td>
          <td class="paramtype">(<a class="el" href="interface_j_c_client.html">JCClient</a> *)&#160;</td>
          <td class="paramname"><em>client</em></td>
        </tr>
        <tr>
          <td class="paramkey">callback:</td>
          <td></td>
          <td class="paramtype">(id&lt; <a class="el" href="protocol_j_c_storage_callback-p.html">JCStorageCallback</a> &gt;)&#160;</td>
          <td class="paramname"><em>callback</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>创建 <a class="el" href="interface_j_c_storage.html">JCStorage</a> 对象</p>
<p><a class="el" href="interface_j_c_storage.html">JCStorage</a> 的所有接口函数，如无特殊说明，都建议在主线程调用</p>
<dl class="section note"><dt>注解</dt><dd><ul>
<li>调用此方法创建 <a class="el" href="interface_j_c_storage.html">JCStorage</a> 对象后，期间没有调用过 <a class="el" href="interface_j_c_storage.html#a845f5e55177573aad2972ab1edf32002">destroy</a> 方法销毁对象，然后又重复调用此方法，会直接返回第一次创建的 <a class="el" href="interface_j_c_storage.html">JCStorage</a> 对象</li>
<li>调用此方法前确保 <a class="el" href="interface_j_c_client.html">JCClient</a> 已完成初始化，即 <a class="el" href="interface_j_c_client.html#af428728decbaf19a2ac6552a07351a65">state</a> 获取的状态值不等于 <a class="el" href="group___xE7_x99_xBB_xE5_xBD_x95_xE6_xA8_xA1_xE5_x9D_x97.html#gga485360c806cb3a83e41ac56a9ad7e709a5a6b582ba8275e39567b419ce05b7860">JCClientStateNotInit</a></li>
</ul>
</dd></dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">client</td><td><a class="el" href="interface_j_c_client.html">JCClient</a> 对象 </td></tr>
    <tr><td class="paramname">callback</td><td><a class="el" href="protocol_j_c_storage_callback-p.html">JCStorageCallback</a> 对象，用于回调相关通知 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回 <a class="el" href="interface_j_c_storage.html">JCStorage</a> 对象 </dd></dl>
<dl class="exception"><dt>异常</dt><dd>
  <table class="exception">
    <tr><td class="paramname">JCClient、JCStorageCallback 任意一个参数传空就会出现调用异常</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a845f5e55177573aad2972ab1edf32002"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a845f5e55177573aad2972ab1edf32002">&#9670;&nbsp;</a></span>destroy</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">+ (void) destroy </td>
          <td></td>
          <td class="paramname"></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>销毁对象</p>
<dl class="section note"><dt>注解</dt><dd>此方法为异步调用，所以在调用此方法后不能马上调用 <a class="el" href="interface_j_c_storage.html#ae49efaa195466115f07b20ae07bee4a8">create</a> 方法去重新创建 <a class="el" href="interface_j_c_storage.html">JCStorage</a> 对象 </dd></dl>

</div>
</div>
<a id="a4edb9dbd883adbb92c151bc0ef5f5e15"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4edb9dbd883adbb92c151bc0ef5f5e15">&#9670;&nbsp;</a></span>downloadFile:savePath:cookie:</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (<a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a>*) downloadFile: </td>
          <td></td>
          <td class="paramtype">(NSString *)&#160;</td>
          <td class="paramname"><em>uri</em></td>
        </tr>
        <tr>
          <td class="paramkey">savePath:</td>
          <td></td>
          <td class="paramtype">(NSString *)&#160;</td>
          <td class="paramname"><em>savePath</em></td>
        </tr>
        <tr>
          <td class="paramkey">cookie:</td>
          <td></td>
          <td class="paramtype">(id)&#160;</td>
          <td class="paramname"><em>cookie</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>下载文件</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">uri</td><td>文件地址 </td></tr>
    <tr><td class="paramname">savePath</td><td><b>本地文件保存地址，由用户自行指定，需精确到文件名及格式，例如：/Documents/JuphoonCloud/audio.wmv。请确保目录存在且可写。</b> </td></tr>
    <tr><td class="paramname">cookie</td><td>标志数据<ul>
<li><a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> 对象：<ul>
<li>调用底层接口成功，返回的 <a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> 对象的状态为 JCStorageItemStateTransfering，并且会收到 <a class="el" href="protocol_j_c_storage_callback-p.html#aedb19f5b9c167fae30966c5e34b22afb">onFileUpdate</a> 回调</li>
<li>调用底层接口失败，返回的 <a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> 对象的状态为 JCStorageItemStateFail，并且会收到 <a class="el" href="protocol_j_c_storage_callback-p.html#a086c6c8b7e0e0188d8e8954b0288fd54">onFileResult</a> 回调</li>
</ul>
</li>
<li>null：异常调用，不会收到回调 </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a179729e095c867fa7624fd1eb3e44a79"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a179729e095c867fa7624fd1eb3e44a79">&#9670;&nbsp;</a></span>uploadFileByExpireTime:expiredSeconds:cookie:</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (<a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a>*) uploadFileByExpireTime: </td>
          <td></td>
          <td class="paramtype">(NSString *)&#160;</td>
          <td class="paramname"><em>path</em></td>
        </tr>
        <tr>
          <td class="paramkey">expiredSeconds:</td>
          <td></td>
          <td class="paramtype">(int)&#160;</td>
          <td class="paramname"><em>expiredSeconds</em></td>
        </tr>
        <tr>
          <td class="paramkey">cookie:</td>
          <td></td>
          <td class="paramtype">(id)&#160;</td>
          <td class="paramname"><em>cookie</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>上传文件</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">path</td><td><b>文件路径，需精确到文件名及格式，例如：/Documents/JuphoonCloud/audio.wmv。请确保目录存在。</b> </td></tr>
    <tr><td class="paramname">cookie</td><td>标志数据 </td></tr>
    <tr><td class="paramname">expiredSeconds</td><td>过期秒数，-1表示永久 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd><ul>
<li><a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> 对象：<ul>
<li>调用底层接口成功，返回的 <a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> 对象的状态为 JCStorageItemStateTransfering，并且会收到 <a class="el" href="protocol_j_c_storage_callback-p.html#aedb19f5b9c167fae30966c5e34b22afb">onFileUpdate</a> 回调</li>
<li>调用底层接口失败，返回的 <a class="el" href="interface_j_c_storage_item.html">JCStorageItem</a> 对象的状态为 JCStorageItemStateFail，并且会收到 <a class="el" href="protocol_j_c_storage_callback-p.html#a086c6c8b7e0e0188d8e8954b0288fd54">onFileResult</a> 回调</li>
</ul>
</li>
<li>null：异常调用，不会收到回调 </li>
</ul>
</dd></dl>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>JCSDKOC/JCSDKOC/JCStorage/<a class="el" href="_j_c_storage_8h_source.html">JCStorage.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
